/*
 * Rect.cpp
 *
 *  Created on: Jul 24, 2010
 *      Author: Ry
 */

#include "Rect.h"

Rect::Rect() {

}

Rect::Rect(int x, int y, int width, int height) {
	this->x = x;
	this->y = y;
	this->width = width;
	this->height = height;
}

bool Rect::inside(int x, int y) {
	return x >= this->x &&
		x <= this->x + width &&
		y >= this->y &&
		y <= this->y + height;
}

void Rect::positionAt(int x, int y) {
	this->x = x;
	this->y = y;
}

void Rect::centerAt(int x, int y) {
	this->x = x - width / 2;
	this->y = y - height / 2;
}

int Rect::centerX() {
	return x + width / 2;
}

int Rect::centerY() {
	return y + height / 2;
}

Rect::~Rect() {
	// TODO Auto-generated destructor stub
}
